home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-08-14 | 8.7 KB | 213 lines | [TEXT/R*ch] |
- BBEdit Extensions for MacPerl
- =============================
-
- by Brad Hanson (bhanson@avalon.net, BradH5@aol.com)
- August 14, 1996
-
- The package contains four BBEdit extensions that facilitate the use of BBEdit as
- an external editor for MacPerl. MacPerl is a Macintosh port of the Perl
- programming language by Matthias Neeracher. Information about MacPerl is
- available at
- http://err.ethz.ch/members/neeri/macintosh/perl-qa.html
-
- The latest versions of these extensions will be available at
- ftp://users.aol.com/bradh5/MacPerl_BBEdit_extensions.sit
-
- The four extensions included are: 1) Run MacPerl, 2) Run MacPerl Front, 3) Run
- File with MacPerl, and 4) Edit MacPerl Script. These extensions are independent
- of one another and any of them can be installed without the others. To install an
- extension put it in the "BBEdit Extensions" folder that is in the same folder as
- the BBEdit application. If BBEdit is running the extension will only appear in
- the Extensions menu after BBEdit is quit and restarted. A command key can be
- assigned to the BBEdit extension by using the "Set Keys" item in the BBEdit
- Extensions menu.
-
- These extensions are 68K BBEdit extensions and should work on a 68K or
- PowerPC Macintosh with MacPerl 4 or 5, and BBEdit (version 3.5 or later) or
- BBEdit Lite (version 3.0.1 or later). The extensions require Macintosh system
- software version 7.0 or later. These extensions are freeware. If you have
- any questions or comments, or would like a copy of the source code, please let me
- know. I thank Matthias Neeracher for his assistance in the design of the
- Run File with MacPerl and Edit MacPerl Script extensions.
-
- Descriptions of each of the four extensions are given below.
-
- Run MacPerl
- -----------
-
- This extension sends the text in the active BBEdit window to MacPerl to be
- executed as a Perl script. If a Perl script executed by the extension writes
- output to STDOUT or STDERR then a new BBEdit window is created and the output is
- put into the new window after the script is finished executing (any STDERR text
- is first followed by the STDOUT text). MacPerl must be running before the
- extension is executed, otherwise an alert is displayed. Typing the command and
- period keys together will terminate the extension, although the Perl script
- started by the extension will still be running.
-
- A limitation of the extension is that any MacPerl specific functions contained in
- a Perl script that put up a dialog (such as MacPerl::Choose or MacPerl::Ask) will
- not function properly. This is because BBEdit is the active application when the
- extension is run and the MacPerl functions that put up a dialog expect MacPerl to
- be the active application. Another limitation is that the extension will not work
- with scripts that use STDIN. The Run MacPerl Front extension described below can
- be used to run scripts containing MacPerl commands that put up a dialog or use
- STDIN.
-
- Run MacPerl Front
- -----------------
-
- When this extension is run MacPerl is brought to the front, and the contents
- of the active BBEdit window are sent to MacPerl to be executed as though
- run using the Run Script command in MacPerl (e.g., STDOUT is sent to the MacPerl
- STDOUT window rather than to a new BBEdit window). This extension can be used to
- run any script that can be run directly with MacPerl, whereas there are some
- scripts (e.g., those that use STDIN) that will not work with the Run MacPerl
- extension described above.
-
- One small problem is that after the extension is run and BBEdit is switched
- to the background the front BBEdit window is not fully deactivated (e.g.,
- the scroll bars will appear active and the insertion point will still blink).
- This appears to be a cosmetic problem - BBEdit will continue to operate
- normally when it is brought back to the front.
-
- Run File with MacPerl
- ---------------------
-
- When this extension is executed a standard file dialog is displayed to select
- a file to be sent to MacPerl to be executed as a Perl script. The extension
- functions identically to the "Run MacPerl" extension with the exception that
- the Perl script to be executed is contained in a file selected from a
- standard file dialog rather than the active BBEdit window.
-
- Edit MacPerl Script
- -------------------
-
- When this extension is executed a standard file dialog is displayed to select a
- file to be edited in BBEdit. This extension is useful for editing Perl scripts
- in file types that cannot be edited normally by BBEdit (runtimes, droplets,
- etc.), although the extension can also be used to edit normal text files. This
- extension requires MacPerl 5.1.0r2 or later.
-
- After the extension is executed, and a file selected from the standard file
- dialog, the Perl script contained in the file will be displayed in a new BBEdit
- window. To save changes made to the text in the BBEdit window MacPerl needs to be
- given a command to update the file. In BBEdit versions 4.0 and later the update
- command is given automatically when the file is saved. This extension is most
- useful if used with version 4.0 or later of BBEdit, although it can be used with
- BBEdit version 3.5 and BBEdit Lite version 3.0.1 or later.
-
- In BBEdit version 3.5 and BBEdit Lite the update command must be given by
- switching to MacPerl and selecting Update from the BBEdit menu (the BBEdit menu
- will be present if Internet Config version 1.2 is installed and BBEdit has been
- chosen as the editor helper application). If the BBEdit window is saved and
- closed without telling MacPerl to update it, the original file will not be
- updated. If a window is closed without updating, the original file can still be
- updated by choosing Update… from the BBEdit menu in MacPerl. The original file
- should appear in the list of files that can be updated.
-
- Tips
- ----
-
- A useful tip for using MacPerl with BBEdit that it is possible to use ResEdit to
- modify the MacPerl application so that the files created by a Perl script will
- have BBEdit as the creator (rather than MPW). Open the MacPerl application with
- ResEdit and open the resource of type GU∑I (there should be one resource of this
- type). The field named "Creator of created files" contains a four character
- application signature. Change the text of this field to R*ch (the application
- signature of BBEdit) and save the modified MacPerl application.
-
- With the Run MacPerl and Run MacPerl Front extensions the syntax of a script
- can be checked by putting "#!perl -c" (without the quotes) as the first line
- of the script. To run the script remove the "-c" from the first line.
-
- Of related interest is the BBEdit Script Extension for MacPerl written by
- Matthias Neeracher. This allows Perl scripts to be saved as BBEdit extensions by
- MacPerl. There is a Perl interface to BBEdit that allows MacPerl scripts saved as
- BBEdit extensions to use BBEdit extension callbacks. Unfortunately, the last time
- I checked (using the 07Feb96 version of the BBEdit Script Extension with MacPerl
- 5.0.6) the BBEdit extension callbacks did not work on 68000 Macintoshes (they do
- work on PowerPC Macintoshes). The BBEdit Script Extension for MacPerl is
- available from
- <ftp://err.ethz.ch/pub/neeri/MacPerl/MPBBEdit_07Feb96.sit.bin>
-
-
- Version History of Run MacPerl
- ------------------------------
-
- July 14, 1996 - Version 1.0.2
-
- - Routine descriptors are disposed of (this should have no effect
- on the current 68K extension).
-
-
- July 7, 1996 - Version 1.0.1
-
- - Minor changes to allow the source code to be shared with other
- extensions. The extension should function identically to Version 1.0.
-
- - Changed name from Run Perl Script to Run MacPerl.
-
-
- April 15, 1996 - Version 1.0
-
- - Pressing command-period will stop the extension.
-
- - Added alerts for more informative error messages.
-
- - Added version resource.
-
-
- January, 1996 - Version 0 (actually no version number)
-
- I submitted this initial version to the MacPerl mailing list.
-
-
- Version History of Run MacPerl Front
- ------------------------------------
-
- July 14, 1996 - Version 1.0.2
-
- - The switch to MacPerl is now done as the last step if no errors
- have occurred. Routine descriptors are disposed of (this should
- have no effect on the current 68K extension). Should function
- identically to Version 1.0.
-
-
- July 10, 1996 - Version 1.0.1
-
- - Exactly the same as Version 1.0 except for the version number.
- I created this by mistake and sent it to a few people.
-
-
- July 10, 1996 - Version 1.0
-
- - Initial version. Distributed to MacPerl mailing list.
-
-
- Version History of Run File from MacPerl
- ----------------------------------------
-
- July 14, 1996 - Version 1.0.1
-
- - Routine descriptors are disposed of (this should have no effect
- on the current 68K extension).
-
-
- July 7, 1996 - Version 1.0
-
- - Initial version.
-
-
- Version History of Edit MacPerl Script
- --------------------------------------
-
- July 14, 1996 - Version 1.0.1
-
- - Routine descriptors are disposed of (this should have no effect
- on the current 68K extension).
-
-
- July 7, 1996 - Version 1.0
-
- - Initial version.
-